package javabase.schoolwork.day6_07;

/**
 * @author fance
 * @date 2018/6/7 20:27
 */
class MyThreadJoin implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 50; i++) {
            System.out.println(Thread.currentThread().getName() + " " + i);
        }
    }
}
public class ThreadJoin {
    public static void main(String[] args) {
        MyThreadJoin threadJoin = new MyThreadJoin();

        Thread thread = new Thread(threadJoin,"son  ..");
        thread.start();
        for (int i = 0; i < 50; i++) {
            if (i > 10) {
                try {
                    thread.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("main run " + i);
        }

    }
}

